package day14;

/**
 * @author oldliu
 * @since 1.0
 */
//计算器
public class Calc {
    public int add(int a,int b){
        return a+b;
    }
    public int add(int a,int b,int c){
        return a+b+c;
    }
    public int add(int a[]){
        return 0;
    }
    //可变参数，其实是数组
    //可以有其他参数，要求，可变参数一定是最后一个
    public int jia(int ...a){
        int sum=0;
        for(int i:a)
            sum+=i;
        return sum;
    }
    public int div(int b,int ...d){
        return 0;
    }

    public static void main(String[] args) {
        Calc c=new Calc();
        int he = c.jia(1, 3, 5, 7, 8, 10);
        System.out.println(he);
        he = c.jia(14);
        System.out.println(he);
        he = c.jia();
        System.out.println(he);
    }
}
